home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Champak 142
/
Volume 142 Oct 17 2011 - Damaged.iso
/
Games
/
operation-graduates.swf
/
scripts
/
frame_41
/
DoAction_12.as
< prev
next >
Wrap
Text File
|
2011-10-17
|
2KB
|
77 lines
function spawnBeehive(xSpot)
{
var _loc1_ = enemyContainer.attachMovie("beehive","enemy" + eConCount++,eConCount);
_loc1_._x = xSpot;
_loc1_._y = -20;
_loc1_.myBuzz = new Sound(_loc1_);
_loc1_.myBuzz.attachSound("sound.beehive.loop");
_loc1_.vel = new Vector();
_loc1_.des = new Vector();
_loc1_.energy = 70;
_loc1_.gotoAndStop(1);
_loc1_.disturbed = false;
_loc1_.move = beehiveMover;
_loc1_.Q1logic = baddyQ1;
_loc1_.Q2logic = baddyQ2;
_loc1_.Q3logic = baddyQ3;
_loc1_.Q4logic = baddyQ4;
_loc1_.hit = beehiveHit;
_loc1_.isHit = false;
_loc1_.collide = beehiveCollide;
}
function beehiveHit()
{
var _loc1_ = this;
if(!_loc1_.disturbed)
{
_loc1_.myBuzz.start(0,999);
_loc1_.disturbed = true;
}
else
{
_loc1_.isHit = true;
_loc1_.setRGB(16777215);
_loc1_.energy -= 5;
if(_loc1_.energy <= 0)
{
_loc1_.myBuzz.stop();
playSound("sound.beehive.explode");
explode(_loc1_);
addScore(250);
baddyKillCount++;
}
}
}
function beehiveMover()
{
var _loc1_ = this;
if(_loc1_.isHit)
{
_loc1_.resetColor();
_loc1_.isHit = false;
}
if(_loc1_.disturbed)
{
_loc1_.des.reset(theHull._x - _loc1_._x,theHull._y - _loc1_._y);
_loc1_.des.setLength(0.5);
_loc1_.vel.plus(_loc1_.des);
_loc1_.vel.setLength(3);
_loc1_._x += _loc1_.vel.x;
_loc1_._y += _loc1_.vel.y;
_loc1_._rotation = Math.atan2(_loc1_.vel.y,_loc1_.vel.x) * 57.29577951308232 - 90;
}
else
{
_loc1_._y += 3;
if(_loc1_._y > 420)
{
_loc1_.removeMovieClip();
}
}
}
function beehiveCollide()
{
this.myBuzz.stop();
explode(this);
}